[ci] add fmtlib - #7165
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces fmt (fmtlib) as a cross-platform dependency and integrates it into the BOINC build/CI toolchain so it can be reliably available for upcoming formatted logging/output work.
Changes:
- Windows: add
/utf-8compile flag and linkfmt(fmt.lib/fmtd.lib) via the shared MSBuild property sheet; fix library directory propagation invboxwrapper.vcxproj. - Autotools: add a
pkg-configcheck that failsconfigurewhenfmtdevelopment files are missing. - macOS + vcpkg: add
fmtto all relevantvcpkg.jsonconfigs; add macOS dependency metadata plus a newmac_build/buildfmt.shand integrate it into the macOS dependency build script.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| win_build/vboxwrapper.vcxproj | Preserves inherited library directories while adding $(TargetDir) for linking. |
| win_build/boinc.props | Adds /utf-8 and links fmt libraries for Debug/Release builds. |
| mac_build/dependencyNames.sh | Adds fmt version/name metadata for macOS dependency scripts. |
| mac_build/buildfmt.sh | New script to build/install static libfmt.a (universal) for macOS dependencies. |
| configure.ac | Adds a pkg-config dependency check for fmt. |
| 3rdParty/vcpkg_ports/configs/msbuild/vcpkg.json | Adds fmt to vcpkg dependencies for MSBuild-based builds. |
| 3rdParty/vcpkg_ports/configs/manager/linux/vcpkg.json | Adds fmt to vcpkg dependencies for the Linux manager config. |
| 3rdParty/vcpkg_ports/configs/libs/windows/vcpkg.json | Adds fmt to vcpkg dependencies for Windows libs config. |
| 3rdParty/vcpkg_ports/configs/libs/vcpkg.json | Adds fmt to vcpkg dependencies for shared libs config. |
| 3rdParty/vcpkg_ports/configs/client/vcpkg.json | Adds fmt to vcpkg dependencies for client config. |
| 3rdParty/vcpkg_ports/configs/apps/mingw/vcpkg.json | Adds fmt to vcpkg dependencies for MinGW apps config. |
| 3rdParty/vcpkg_ports/configs/apps/linux/vcpkg.json | Adds fmt to vcpkg dependencies for Linux apps config. |
| 3rdParty/vcpkg_ports/configs/apps/android/vcpkg.json | Adds fmt to vcpkg dependencies for Android apps config. |
| 3rdParty/buildMacDependencies.sh | Hooks fmt into the macOS dependency build pipeline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| lprefix="/tmp/installed-fmt" | ||
| libPath="./lib" |
| make 1>$stdout_target | ||
| if [ $? -ne 0 ]; then | ||
| rm -f ./lib/fmt_x86_64.a | ||
| return 1 | ||
| fi |
| # Script to build Macintosh 64-bit Intel library of fmt for | ||
| # use in building BOINC. | ||
| # | ||
| # | ||
| ## This script requires OS 10.8 or later | ||
| # |
| ]) | ||
| ]) | ||
| LIBS="$save_LIBS" | ||
| AC_LANG_POP([C++]) | ||
| ]) |
| mv -f ./libfmt.a ./libfmt_x86_64.a | ||
|
|
||
| # Build for arm64 architecture | ||
| make clean 1>$stdout_target | ||
|
|
||
| make 1>$stdout_target | ||
| if [ $? -ne 0 ]; then | ||
| rm -f ./lib/fmt_x86_64.a | ||
| return 1 | ||
| fi | ||
|
|
||
| mv -f ./libfmt.a ./libfmt_arm64.a | ||
|
|
||
| # combine x86_64 and arm libraries | ||
| lipo -create ./libfmt_x86_64.a ./libfmt_arm64.a -output "./libfmt.a" | ||
| if [ $? -ne 0 ]; then | ||
| rm -f ./libfmt_x86_64.a ./libfmt_arm64.a | ||
| return 1 | ||
| fi | ||
|
|
||
| rm -f ./libfmt_x86_64.a ./libfmt_arm64.a |
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
|
@AenBleidd I have fixed a few issues in the Mac build scripts and updated the Mac build instructions. The local build seems to work correctly on my Mac. If it works correctly for the CI build, then I think it is ready from my point of view. |
|
@CharlieFenton, thank you for your fixes. |
|
@AenBleidd : 2 questions. [1] Do you expect to use libfmt mainly in the Manager? If so, I can update the Xcode project to link it to the Manager and add the headers to the header search path. Should i do that? [2] The Mac Manager uses a precompiled prefix header clientgui/mac/MacGUI.pch which includes all the wxWidgets headers, config.h and stdlib.h plus a few other items. If we expect to use libfmt widely (like we now use stdlib) I could add the |
I would like to use it everywhere since it's more comfortable and more powerfull with the better and simpler syntax.
The answer is basically the same: I would not do that unless we start using it in more that one file. So just to summarize: I would not include it into the list of precompiled headers and would not include this library by default until we start using it actively. |
|
In general, .h files should be included only in files that directly use them |
|
@davidpanderson, yes, but if any external header file is heavily used across several files - having it precompiled will significantly lower compilation time. |
Summary by cubic
Add
fmtas a required dependency across Linux, macOS, and Windows. CI installs it on all arches, Autotools enforces it, and macOS builds a universal staticlibfmt.awith updated build scripts and docs.Dependencies
fmtto allvcpkg.jsonconfigs (apps/libs/client/msbuild/android/mingw/manager) and the testsboincport.libfmt-devfor x64, i386, arm64, and armhf in bothlinux.ymlandlinux-release.yml(including non-vcpkgarm paths).fmtviapkg-configor fallback header/link check; clear error if missing.mac_build/buildfmt.shbuilds staticlibfmt.afor x86_64/arm64 (10.13 min); integrated intobuildMacDependencies.sh,dependencyNames.sh, andsetupForBOINC.sh; docs updated to includefmt; minor fixes inbuildlibzip.sh; usewget -Ofor downloads.fmtonly where used (boinc,boincapi,boinc_zip); tests addfind_dependency(fmt); Windows resolvesfmtviavcpkg; fixedvboxwrapper.vcxprojadditional library paths.Migration
libfmt-dev(Debian/Ubuntu) orlibfmt-devel(Fedora), or usevcpkg.buildMacDependencies.sh/setupForBOINC.shbuildfmtautomatically.vcpkgpullsfmt; clean rebuild if linker errors appear.Written for commit bc28b58. Summary will update on new commits.